<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml"> 
 
<head> 
	<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> 
	<title>湖南省自来水公司营销管理信息系统</title> 
	
	<link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/text.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/form.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/buttons.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/grid.css" type="text/css" media="screen" title="no title" />	
	<link rel="stylesheet" href="../css/layout.css" type="text/css" media="screen" title="no title" />	
	
	<link rel="stylesheet" href="../css/ui-darkness/jquery-ui-1.8.12.custom.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/plugin/jquery.visualize.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/plugin/facebox.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/plugin/uniform.default.css" type="text/css" media="screen" title="no title" />
	<link rel="stylesheet" href="../css/plugin/dataTables.css" type="text/css" media="screen" title="no title" />
	
	<link rel="stylesheet" href="../css/custom.css" type="text/css" media="screen" title="no title">

</head> 
 
<body> 

<div id="wrapper">
	
		
<div id="bool"><script>window.onload=function (){  $("#bool").load("../ming.html");}</script></div>

	
	<div id="masthead">
		<div>
			<span id="pagetitle"><a href="javascript:;">片区权限</a></span>
			<span id="welcome_span">欢迎回来，马云</span>
		</div>
	</div> <!-- #masthead -->	
	
	<div id="content" class="xgrid">
		
 		
		<div class="x12">
			
			<h2>设置片区权限</h2>
			
			<div class="form label-inline uniform">
			
				<div class="field">
					<span class="bold">正在设置以下员工的片区权限<span> <br/>
					<span class="red" v-if="Syemps!=''">注意：你正在编辑多个员工的片区权限，不会显示这些员工的原有权限。
							<br/>仅仅在只编辑一个员工时，才会显示该员工的原有权限。</span>
				</div>
	
				<div class="field">
					<textarea class="medium" disabled="disabled" style="width:100%;height:50px;" />
					</textarea>
				</div>
				
				<div class="controlset field" v-for="are in  Syares">
					<span class="label">{{are.areaName}}</span>
					<div class="controlset-pad"><input type="checkbox" :value="are.id" :checked="are.disabled?'checked':''"/></div>
				</div>	

			
				<div class="buttonrow">
					<button class="btn" @click="baochu()">保存</button>
					<button class="btn btn-grey" onClick="history.back(-1);">返回</button>
				</div>
			</div>
			
		</div> <!-- .x12 -->
		
	</div> <!-- #content -->
	
	<div id="footer">		
		<div class="content_pad">			
			<p>&copy; 2013-11 版权所有 <a href="#">湖南省自来水公司</a>.   技术支持 <a href="#">职业教育</a>.</p>
		</div> <!-- .content_pad -->
	</div> <!-- #footer -->
	
</div> <!-- #wrapper -->

<script src="../js/jquery/jquery-1.5.2.min.js"></script>
<script src="../js/jquery/jquery-ui-1.8.12.custom.min.js"></script>
<script src="../js/misc/excanvas.min.js"></script>
<script src="../js/jquery/facebox.js"></script>
<script src="../js/jquery/jquery.visualize.js"></script>
<script src="../js/jquery/jquery.dataTables.min.js"></script>
<script src="../js/jquery/jquery.tablesorter.min.js"></script>
<script src="../js/jquery/jquery.uniform.min.js"></script>
<script src="../js/jquery/jquery.placeholder.min.js"></script>

<script src="../js/widgets.js"></script>
<script src="../js/dashboard.js"></script>
<script src="../js/vue.js"></script>
<script type="text/javascript">

    var empid = new Array();
    function  load() {
        $.getJSON("../SyArea/queryall",{},function(json){
            app.Syares=json;
            if(app.Symen!=null){
                $.each(app.Symen,function () {
                    var mun = this.areaID;
                    $.each(app.Syares,function(){
                        if(mun==this.id){
                            this.disabled=true;
                        }
                    });
                });}
        });
    }
    var app = new Vue({
        el:"#wrapper",
        data:{
            Syares:'',
            Symen:[],
            Syemps:'',
        },
        methods:{
            update(id){
                location="sys_menupower_set.html?id="+id;
            },
            query(){
                $("#lai").val($("#type").val());
                $("#lai").keyup();
            },
            baochu(){
                var che = $(":checkbox");
                var menuid=new Array();
                $.each(che,function(){
                    if(this.checked==true){
                        menuid.push(this.value);
                    }
                });
                $.getJSON("../Syempareapower/add?empid="+empid+"&menuid="+menuid,{},function (json) {
                    if(json==1){
                        alert("保存成功");
                        location="sys_areapower.html";
                    }
                });
            }
        },
        //监听事件
        watch:{
            Syares:function(){
                this.$nextTick(function(){
                    $(document).ready ( function ()
                    {
                        Dashboard.init ();
                    });
                });
            }
        },
        created(){
            var empids  = JSON.parse(localStorage.getItem("list"));
            if(empids!=null){
                empid.push(empids);
                $.getJSON("../Syemp/queryByids?empids="+empids,{},function(json){
                    app.Syemps=json;
                    var str='';
                    $.each(app.Syemps,function () {
                        if(app.Syemps[app.Syemps.length-1]==this){
                            str+=this.empNmae;
                        }else{
                            str+=this.empNmae+",";}
                    });
                    $("textarea:eq(0)").val(str);
                });
            }
            var u = new URLSearchParams(location.search);
            var id = u.get("id");
            if(id!=null){
                $("textarea:eq(0)").val(u.get("name"));
                empid.push(id);
                $.getJSON("../Syempareapower/querybyid/"+id,{},function(json){
                    app.Symen=json;
                });
            }
            load();
        }
    });
</script>

</body> 
 
</html>